package org.zachary.agent.infrastructure.utils;

public enum ServiceResultStatus {
    SUCCESS,
    FAILURE,
    EXCEPTION,
    InvalidParameter;

    public Integer toInteger(){
        return switch (this) {
            case SUCCESS -> 1;
            case FAILURE -> 2;
            case EXCEPTION -> 3;
            case InvalidParameter -> 4;
        };
    }
    public static ServiceResultStatus fromInteger(Integer integer){
        return switch (integer) {
            case 1 -> SUCCESS;
            case 2 -> FAILURE;
            case 3 -> EXCEPTION;
            case 4 -> InvalidParameter;
            default -> throw new InternalError("ServiceResultStatus  Unexpected value: " + integer);
        };
    }
}
